from datetime import datetime
from config.database import Base
from sqlalchemy import Column, Integer, String, DateTime, Numeric


class KylinFutureStrategyPosition(Base):
    """
    期货策略仓位表
    """

    __tablename__ = 'kylin_future_strategy_position'
    id = Column(Integer, primary_key=True, autoincrement=True, comment='仓位id')
    date = Column(String(10), nullable=False, comment='交易日期')
    strategy_instance = Column(String(50), nullable=False, comment='策略实例名称')
    position = Column(Numeric(10, 2), nullable=False, default=0, comment='总仓位')
    long_position = Column(Numeric(10, 2), nullable=False, default=0, comment='多仓')
    short_position = Column(Numeric(10, 2), nullable=False, default=0, comment='空仓')
    create_time = Column(DateTime, default=datetime.now, comment='创建时间')
    update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')